package com.mingtu.guards.adapter;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.SPStaticUtils;
import com.blankj.utilcode.util.StringUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingtu.common.utils.SPTools;
import com.mingtu.guards.R;
import com.mingtu.guards.bean.MyReportRecordBean;

public class LeaderReportEventAdapter extends BaseQuickAdapter<MyReportRecordBean.PageBean.ListBean, BaseViewHolder> {

    boolean isLeader = SPStaticUtils.getBoolean(SPTools.isLeader);

    public LeaderReportEventAdapter() {
        super(R.layout.item_leader_report_event);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, MyReportRecordBean.PageBean.ListBean listBean) {
        String name = listBean.getName();
        String createTime = listBean.getCreateTime();
        String address = listBean.getAddress();
        String tag = listBean.getTag();
        if (isLeader) {
            helper.setGone(R.id.layout_people, true);
            if (!StringUtils.isEmpty(name)) {
                helper.setText(R.id.tv_people, name);
            }
        } else {
            helper.setGone(R.id.layout_people, false);
        }


        if (!StringUtils.isEmpty(createTime)) {
            helper.setText(R.id.tv_time, createTime);
        }

        if (!StringUtils.isEmpty(address)) {
            helper.setText(R.id.tv_address, address);
        }

        if (!StringUtils.isEmpty(tag)) {
            helper.setText(R.id.tv_type, tag);
        }

    }

}
